<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <title>{%if title%}{{title}} &mdash; Gitshell{%else%}欢迎来到 Gitshell{%endif%}</title>
    <meta content="Gitshell 专注git代码托管, 团队协同，项目开发" name="description">
    <meta content="Gitshell" name="author">
    <link href="/static/less/app/font-awesome/css/font-awesome.min.css?timestamp={{gitshell.timestamp}}" rel="stylesheet" type="text/css">
    {% if gitshell.mode == 'run' %}
    <link href="/static/less/min/gitshell.min.css?timestamp={{gitshell.timestamp}}" rel="stylesheet" type="text/css">
    {% else %}
    <link href="/static/less/gitshell.less" rel="stylesheet/less" type="text/css">
    <script>
      less = { env: "development" }
    </script>
    <script src="/static/js/less-1.4.0.min.js"></script>
    {% endif %}
    {% block css %}{% endblock %}
    <link rel="shortcut icon" href="/static/img/favicon.ico">
    <meta name="csrf-token" content="{{csrf_token}}">
    {% if user.is_authenticated %}
    <meta name="username" content="{{user.username}}">
    {% endif %}
  </head>
  <body id="gitshell" class="{% block body_class_name %}{% endblock %}">
    <!--[if lt IE 10]>
    <p class="upgrade">Gitshell<strong>不支持您的浏览器</strong>. 继续浏览请先<a href="http://browsehappy.com/" target="_blank">升级您的浏览器</a>.或者在您的IE浏览器上安装<a href="http://www.google.com/chromeframe?prefersystemlevel=true&hl=zh-CN" target="_blank">谷歌浏览器内嵌框架</a>。</p>
    <![endif]-->
    <nav class="navbar" role="navigation">
      <div class="container">

      {% if user.is_authenticated %}
        <a class="brand" href="/dashboard/feed/" role="logo"><span>Gitshell</span></a>
      {% else %}
        <a class="brand" href="/" role="logo"><span>Gitshell</span></a>
      {% endif %}
      <ul class="nav main-nav">
        {% if user.is_authenticated %}
          <li{% if mainnav == '/dashboard/notif' %} class="active"{% endif %}><a href="/dashboard/notif/" class="todo">工作台<span class="label-mini label-warning hide">{{userprofile.unread_message}}</span></a></li>
          <li class="dropdown{% if mainnav == '/{{user.username}}/-/repo/' %}active{% endif %}">
            <a href="javascript:;" class="dropdown-toggle repo-shortcut" data-toggle="dropdown">仓库<i class="icon-caret-down"></i></a>
            <ul class="dropdown-menu repo-shortcut-ul">
              <li class="all"><a href="/{{user.username}}/-/repo/">所有仓库</a></li>
              <li class="repo-loading"><img src="/static/img/loading.gif"></li>
              <li class="create"><a href="/{{user.username}}/-/repo/create/"><i class="icon-pencil"></i>新建仓库</a></li>
            </ul>
          </li>
          <li class="create-repo"><a href="/{{user.username}}/-/repo/create/"><span class="button"><i class="icon-pencil"></i>新建仓库</span></a></li>
        {% else %}
        <li><a href="/login/">工作台</a></li>
        <li><a href="/login/">仓库</a></li>
        {% endif %}
      </ul>


      {% if user.is_authenticated %}
      <ul class="nav userbar">
        {% comment %}
        {% if userprofile.unread_message > 0 %}
        <li class="msgs"><a href="/dashboard/notif/" class="label label-warning">{{userprofile.unread_message}}</a></li>
        {% endif %}
        {% endcomment %}

        <li class="dropdown cong">
          <a href="/{{ user.username }}/" class="dropdown-toggle" data-toggle="dropdown">
            {% if teamUser %}
              <img src="/static/img/teamavatar.png" alt="{{ teamUser.username }}">
              <span class="name">{{teamUser.username}}</span>
            {% else %}
              <img src="https://gravatar.com/avatar/{{ userprofile.imgurl }}?s=16" alt="{{ user.username }}">
              <span class="name">{{user.username}}</span>
            {% endif %}
            <i class="icon-caret-down"></i>
          </a>
          <div class="dropdown-menu" role="menu" aria-labelladby="dLable">
            <div class="info">
              <div class="detail">
                <h2 class="heading">{{ user.username }}</h2>
                <p class="actions">
                  <a href="/{{user.username}}/">个人主页</a><br>
                  <a href="/settings/">设置</a><br>
                </p>
              </div>
              <figure class="avatar">
                <img src="https://gravatar.com/avatar/{{ userprofile.imgurl }}?s=80" alt="{{ user.username }}">
              </figure>
            </div>
            <ul class="team-accounts nav nav-list">
              <li class="create"><a href="/settings/team/create/" class="create-team-link"><em>添加团队账户</em></a></li>
              {% for teamMember in gs_teamMembers %}
              <li><img src="/static/img/teamavatar.png" alt="{{teamMember.team_user.username}}"><a href="/{{teamMember.team_user.username}}/-/dashboard/">{{ teamMember.team_user.username }}</a></li>
              {% endfor %}
            </ul>
            <div class="other">
              <a href="/logout/" class="logout btn btn-mini">登出</a>
              <span class="feedback">
                <a href="/help/">帮助</a>
                <span>·</span>
                <a href="#">反馈</a>
              </span>
            </div>
          </div>
        </li>
      </ul>
      {% else %}
      <p class="welcome-msg">请<a href="/login/"{%if mainnav == 'login'%}class="active"{%endif%}>登录</a>,或者<a href="/join/0/"{%if mainnav == 'join'%}class="active"{%endif%}>注册</a></p>
      {% endif %}
    </div>
  </nav>

  {% block repo_header %}{% endblock %}

  <main class="main {% block container_class_name %}{% endblock %}" role="main">
    {% block container %}{% endblock %}
  </main>

  <footer class="footer" role="contentinfo">
    <div class="container">
      <ul class="nav">
        <li><a href="/help/#about" class="about-gitshell">关于Gitshell</a></li>
        <li><a href="/help/">帮助</a></li>
        <li><a target="_blank" href="http://blog.gitshell.com">官方博客</a></li>
      </ul>
      <p class="copyright">&copy; <strong>Gitshell</strong> 2013 专注<a target="_blank" href="http://git-scm.com/">Git</a>代码托管<a class="muted" href="http://www.miitbeian.gov.cn">苏ICP备12042031号</a></p>
    </div>
  </footer>
  <a href="#" class="btn hide">返回顶部</a>

  <script src="/static/js/min/lib.min.js?timestamp={{gitshell.timestamp}}"></script>
  {% if gitshell.mode == 'run' %}
  <script src="/static/js/min/gitshell.min.js?timestamp={{gitshell.timestamp}}"></script>
  {% else %}
  <script src="/static/js/gitshell-template.js"></script>
  <script src="/static/js/gitshell.js"></script>
  {% endif %}
  {% block js %}{% endblock %}
  <script>
    var _gaq = _gaq || [];
    _gaq.push(['_setAccount', 'UA-33142900-1']);
    _gaq.push(['_trackPageview']);

    (function() {
      var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
      ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
      var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
    })();
  </script>
</body>
</html>
